package cn.edu.fudan.rule;

import cn.edu.fudan.type.DataItem;
import cn.edu.fudan.type.Rule;
import cn.edu.fudan.type.WaveletPerOrder;

import java.util.List;

/**
 * Created by 80494 on 2017/4/6.
 */
public class Classifier {
    public int Classifier(List<DataItem> TestInstance, List<Rule> Rpie, int defaultclass){
        WaveletPerOrder TW=new WaveletPre().WaveletPre(TestInstance);
        int label=defaultclass;
        int order = 0;
        for(int i=0;i<Rpie.size();i++){

            order= Rpie.get(i).getPattern().getOrder();
            if(order>=Rpie.size() || order>=TW.getDseries().size()) break;
            if(new RuleGeneration().PatternIsSubpatternOfSeries(Rpie.get(i).getPattern(),TW.getDseries().get(order),order)){

                label=Rpie.get(i).getLabel();
                break;
            }
        }
        return label;
    }


}
